﻿@{
    Layout = "~/Areas/Admin/Views/Shared/_AdminLayout.cshtml";
    ViewBag.Title = "文章审核 - 果壳园";
}
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 文章管理 <span class="c-gray en">&gt;</span> 文章审核 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <div class="text-c">
        <form class="Huiform" method="post" action="" target="_self">
            <input type="text" class="input-text" style="width:250px" placeholder="权限名称" id="" name="">
            <button type="submit" class="btn btn-success" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜权限节点</button>
        </form>
    </div>
    <div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"><a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a> <a href="javascript:;" onclick="admin_permission_add('添加权限节点','admin-permission-add.html','','310')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加权限节点</a></span> <span class="r">共有数据：<strong>54</strong> 条</span> </div>
    <table class="table table-border table-bordered table-bg" id="list" width="100%">
        <thead>
            <tr>
                <th width="40">
                    <input type="checkbox" class="checkall" />
                </th>
                <th width="80">ID</th>
                <th>标题</th>
                <th>作者</th>
                <th width="100">分类</th>
                <th>更新时间</th>
                <th>状态</th>
                <th width="180">操作</th>
            </tr>
        </thead>
    </table>
</div>
@section script{
    <script src="~/Content/hui-admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
    <script src="~/Content/scripts/article.js"></script>
    <script type="text/javascript">
        $(function () {
            $(".checkall").click(function () {
                $(".checkchild").attr("")
            })
            
            var table = $('#list').DataTable({
                ajax: {
                    url: '@Url.Action("GetArticles")',
                    type: 'post'
                },
                language: lang,
                aLengthMenu: [20, 50, 100],
                processing: true,
                paging: true,
                searching: false,
                info: true,
                serverSide: true,
                columns: [
                    {
                        data: "Article_Id",
                        render: function (data, type, full, meta) {
                            return '<input type="checkbox"  class="checkchild"  value="' + data + '" />';
                        },
                        sortable: false
                    },
                    { class: "text-center", data: 'Article_Id' },
                    {
                        data: 'Title'
                    },
                    {
                        data: 'Nickname'
                    },
                    {
                        data: 'Cate_Name', class: "text-center", render: function (data, type, row, meta) {
                            if (data == null) {
                                return "未分类";
                            }
                            return data;
                        }
                    },
                    {
                        class: "text-center", data: 'Creation_Time', render: function (data, type, row, meta) {
                            data.replace(/Date\([\d+]+\)/, function (a) { eval('d = new ' + a) });
                            return d.format("yyyy-MM-dd hh:mm:ss");
                        }
                    },
                    {
                        data: 'State', class: "text-center", render: function (data, type, row, meta) {
                            if (data == 3) {
                                return '<span class="am-badge am-badge-success">已发布</span>';
                            } else if (data == 2) {
                                return '<span class="am-badge">未审核</span>';
                            } else if (data == 1) {
                                return '<span class="label label-warning radius">草稿</span>';
                            } else if (data == 4) {
                                return '<span class="label label-error radius">未通过</span>';
                            }
                        }
                    },
                    {
                        data: 'Article_Id', class: "text-center", render: function (data, type, row, meta) {
                            return '<div class="tpl-table-black-operation"><a onclick="preview(' + data + ')" href="javascript:;"><i class="am-icon-eye"></i> 预览</a> <a onclick="article_shenhe(' + data + ')" href="javascript:;"><i class="am-icon-pencil"></i> 审核</a> <a href="javascript:;" onclick="article_delete(' + data + ')" class="tpl-table-black-operation-del"><i class="am-icon-trash"></i> 删除</a></div>';
                        }
                    }
                ],
                drawCallback: function (settings) {
                    // 高亮显示当前行
                    $(settings.nTable).find("tbody tr").click(function (e) {
                        $(e.target).parents('table').find('tr').removeClass('warning');
                        $(e.target).parents('tr').addClass('warning');
                    });
                },
            });
        })

    </script>
}
